package com.spring.demo12.eg1;

import com.spring.demo12.processing.EventMulticaster;

/**
 * 用户注册服务
 * @author vhans
 */
public class UserRegisterService {

    // 事件广播器
    private EventMulticaster eventMulticaster;

    /**
     * 注册用户
     */
    public void registerUser(String userName) {
        System.out.printf("用户「%s]注册成功\n", userName);
        // 广播注册事件
        this.eventMulticaster.multicastEvent(new UserRegisterSuccessEvent(this, userName));
    }

    public EventMulticaster getEventMulticaster() {
        return eventMulticaster;
    }

    public void setEventMulticaster(EventMulticaster eventMulticaster) {
        this.eventMulticaster = eventMulticaster;
    }
}
